const os = require("os");
function getNetworkInfo() {
  let address = "127.0.0.1";
  let mac = "";
  const networkInterfaces = os.networkInterfaces();
  for (const iface of Object.values(networkInterfaces)) {
    for (const details of iface) {
      if (
        details.family === "IPv4" &&
        details.mac !== "00:00:00:00:00:00" &&
        details.address !== "127.0.0.1"
      ) {
        mac = details.mac;
        address = details.address;
        return { mac, address };
      }
    }
  }
  return { mac, address };
}
module.exports = getNetworkInfo;
